home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm1 / intsdkss.lha / include / rpc / rpc_msg.h < prev    next >
C/C++ Source or Header  |  1996-04-09  |  4KB  |  194 lines

  1. /* @(#)rpc_msg.h    1.1 87/11/04 3.9 RPCSRC */
  2. /*
  3.  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  4.  * unrestricted use provided that this legend is included on all tape
  5.  * media and as a part of the software program in whole or part.  Users
  6.  * may copy or modify Sun RPC without charge, but are not authorized
  7.  * to license or distribute it to anyone else except as part of a product or
  8.  * program developed by the user.
  9.  *
  10.  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  11.  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  12.  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  13.  *
  14.  * Sun RPC is provided with no support and without any obligation on the
  15.  * part of Sun Microsystems, Inc. to assist in its use, correction,
  16.  * modification or enhancement.
  17.  *
  18.  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  19.  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  20.  * OR ANY PART THEREOF.
  21.  *
  22.  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  23.  * or profits or other special, indirect and consequential damages, even if
  24.  * Sun has been advised of the possibility of such damages.
  25.  *
  26.  * Sun Microsystems, Inc.
  27.  * 2550 Garcia Avenue
  28.  * Mountain View, California  94043
  29.  */
  30.  
  31. #ifndef _RPC_RPC_MSG_H
  32. #define _RPC_RPC_MSG_H
  33.  
  34. /*    @(#)rpc_msg.h 1.7 86/07/16 SMI        */
  35.  
  36. /*
  37.  * rpc_msg.h
  38.  * rpc message definition
  39.  *
  40.  * Copyright (C) 1984, Sun Microsystems, Inc.
  41.  */
  42.  
  43. #define RPC_MSG_VERSION     ((u_long) 2)
  44. #define RPC_SERVICE_PORT    ((u_short) 2048)
  45.  
  46. /*
  47.  * Bottom up definition of an rpc message.
  48.  * NOTE: call and reply use the same overall stuct but
  49.  * different parts of unions within it.
  50.  */
  51.  
  52. enum msg_type {
  53.     CALL=0,
  54.     REPLY=1
  55. };
  56.  
  57. enum reply_stat {
  58.     MSG_ACCEPTED=0,
  59.     MSG_DENIED=1
  60. };
  61.  
  62. enum accept_stat {
  63.     SUCCESS=0,
  64.     PROG_UNAVAIL=1,
  65.     PROG_MISMATCH=2,
  66.     PROC_UNAVAIL=3,
  67.     GARBAGE_ARGS=4,
  68.     SYSTEM_ERR=5
  69. };
  70.  
  71. enum reject_stat {
  72.     RPC_MISMATCH=0,
  73.     AUTH_ERROR=1
  74. };
  75.  
  76. /*
  77.  * Reply part of an rpc exchange
  78.  */
  79.  
  80. /*
  81.  * Reply to an rpc request that was accepted by the server.
  82.  * Note: there could be an error even though the request was
  83.  * accepted.
  84.  */
  85. struct accepted_reply {
  86.     struct opaque_auth    ar_verf;
  87.     enum accept_stat    ar_stat;
  88.     union {
  89.         struct {
  90.             u_long    low;
  91.             u_long    high;
  92.         } AR_versions;
  93.         struct {
  94.             caddr_t where;
  95.             xdrproc_t proc;
  96.         } AR_results;
  97.         /* and many other null cases */
  98.     } ru;
  99. #define ar_results    ru.AR_results
  100. #define ar_vers     ru.AR_versions
  101. };
  102.  
  103. /*
  104.  * Reply to an rpc request that was rejected by the server.
  105.  */
  106. struct rejected_reply {
  107.     enum reject_stat rj_stat;
  108.     union {
  109.         struct {
  110.             u_long low;
  111.             u_long high;
  112.         } RJ_versions;
  113.         enum auth_stat RJ_why;    /* why authentication did not work */
  114.     } ru;
  115. #define rj_vers ru.RJ_versions
  116. #define rj_why    ru.RJ_why
  117. };
  118.  
  119. /*
  120.  * Body of a reply to an rpc request.
  121.  */
  122. struct reply_body {
  123.     enum reply_stat rp_stat;
  124.     union {
  125.         struct accepted_reply RP_ar;
  126.         struct rejected_reply RP_dr;
  127.     } ru;
  128. #define rp_acpt ru.RP_ar
  129. #define rp_rjct ru.RP_dr
  130. };
  131.  
  132. /*
  133.  * Body of an rpc request call.
  134.  */
  135. struct call_body {
  136.     u_long cb_rpcvers;    /* must be equal to two */
  137.     u_long cb_prog;
  138.     u_long cb_vers;
  139.     u_long cb_proc;
  140.     struct opaque_auth cb_cred;
  141.     struct opaque_auth cb_verf; /* protocol specific - provided by client */
  142. };
  143.  
  144. /*
  145.  * The rpc message
  146.  */
  147. struct rpc_msg {
  148.     u_long            rm_xid;
  149.     enum msg_type        rm_direction;
  150.     union {
  151.         struct call_body RM_cmb;
  152.         struct reply_body RM_rmb;
  153.     } ru;
  154. #define rm_call     ru.RM_cmb
  155. #define rm_reply    ru.RM_rmb
  156. };
  157. #define acpted_rply    ru.RM_rmb.ru.RP_ar
  158. #define rjcted_rply    ru.RM_rmb.ru.RP_dr
  159.  
  160.  
  161. /*
  162.  * XDR routine to handle a rpc message.
  163.  * xdr_callmsg(xdrs, cmsg)
  164.  *    XDR *xdrs;
  165.  *    struct rpc_msg *cmsg;
  166.  */
  167. extern bool_t    xdr_callmsg();
  168.  
  169. /*
  170.  * XDR routine to pre-serialize the static part of a rpc message.
  171.  * xdr_callhdr(xdrs, cmsg)
  172.  *    XDR *xdrs;
  173.  *    struct rpc_msg *cmsg;
  174.  */
  175. extern bool_t    xdr_callhdr();
  176.  
  177. /*
  178.  * XDR routine to handle a rpc reply.
  179.  * xdr_replymsg(xdrs, rmsg)
  180.  *    XDR *xdrs;
  181.  *    struct rpc_msg *rmsg;
  182.  */
  183. extern bool_t    xdr_replymsg();
  184.  
  185. /*
  186.  * Fills in the error part of a reply message.
  187.  * _seterr_reply(msg, error)
  188.  *    struct rpc_msg *msg;
  189.  *    struct rpc_err *error;
  190.  */
  191. extern void    _seterr_reply();
  192.  
  193. #endif
  194.